package com.hxkcloud.patient.activitys;

import android.os.Bundle;
import android.os.Message;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.hxkcloud.patient.R;
import com.hxkcloud.patient.popup.DateTimeSelectPopWindow;

/**
 * Created by ray_lei on 2016/7/13.
 */
public class InputXuetangActivity extends BaseActivity implements View.OnClickListener {

    private LinearLayout ll_title;
    private ImageView iv_back;
    private TextView tv_title;

    private EditText timeET;
    private EditText kindET;
    private EditText valueET;
    private DateTimeSelectPopWindow datetimeSelect;

    @Override
    protected void updateByHandler(Message msg) {
        switch (msg.what) {

        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_layout_inputxuetang);
        initView();
        initData();
        initListener();
    }

    @Override
    protected void initView() {
        ll_title = (LinearLayout) findViewById(R.id.ll_title);
        iv_back = (ImageView) findViewById(R.id.iv_title_back);
        tv_title = (TextView) findViewById(R.id.tv_title_title);

        setTitlePadding(ll_title);
        iv_back.setVisibility(View.VISIBLE);
        tv_title.setText(getResources().getText(R.string.xuetanginput_text_title));
        iv_back.setOnClickListener(this);


        timeET = (EditText) findViewById(R.id.inputxuetang_et_time);
        kindET = (EditText) findViewById(R.id.inputxuetang_et_kind);
        valueET = (EditText) findViewById(R.id.inputxuetang_et_value);

    }

    @Override
    protected void initListener() {
        iv_back.setOnClickListener(this);
        timeET.setOnClickListener(this);
        kindET.setOnClickListener(this);

    }

    @Override
    protected void initData() {

    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_title_back:
                finish();
                break;
            case R.id.inputxuetang_et_time:
               // Utils.hideInputMethdView(this,valueET);
                if (datetimeSelect == null) {
                    datetimeSelect = new DateTimeSelectPopWindow(this);
                    datetimeSelect.setTimeListener(new DateTimeSelectPopWindow.TimeListener() {
                        @Override
                        public void setTime(String time) {
                            String timeStr = "";
                            if (time.contains(".")) {
                                timeStr = time.replace(".", "-");
                            }
                            timeET.setText(timeStr);
                        }
                    });
                }
                datetimeSelect.show(ll_title);
                break;
            case R.id.inputxuetang_et_kind:

                break;
        }
    }
}
